package org.jsbd.boss.util;

import java.util.Random;

public class TermUtil {

	private static final String[][] IMSI_PRES = {{"46003","46005","46011"},{"46001","46006","46009"},{"46000","46002","46007","46004"}};

	private static final String IMEI_PRE = "862";


	public static String randomImsi(Integer carrier) {
		String[] pres =  IMSI_PRES[carrier];
		return pres[(int) (pres.length * Math.random())] + getRandomInt(10);
	}


	public static String randomImei() {
		return IMEI_PRE + getRandomInt(12);
	}

	public static String getRandomInt(int digit) {
		Random localRandom = new Random();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < digit; i++) {
			sb.append(String.valueOf(localRandom.nextInt(10)));
		}
		return sb.toString();
	}

}
